package com.yb.nowcoder;

import java.util.Scanner;

public class Main0 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            if (!check(str)) {
                System.out.println("ERROR");
            }
            if (str.charAt(0) >= 97 && str.charAt(0) <= 122) {//字母
                long n = 0;
                for (int i = str.length() - 1, j = 1; i >= 0; i--, j *= 26) {
                    char c = str.charAt(i);
                    n += ((int) c - 96) * j;
                }
                System.out.println(n);
            } else if (str.charAt(0) >= 48 && str.charAt(0) <= 57) {//数字
                String res = "";
                long x = Long.parseLong(str);
                while (x > 0) {
                    long m = x % 26;
                    if (m == 0) m = 26;
                    res = (char) (m + 96) + res;
                    x = (x - m) / 26;
                }
                System.out.println(res);
            }

        }
    }

    public static boolean check(String s) {
        if (s == null || s.length() < 1) {
            System.out.println("ERROR");
        }
        for (int i = 0; i < s.length(); i++) {
            if (!(s.charAt(i) >= 'a' && s.charAt(i) <= 'z') && !(s.charAt(i) >= '0' && s.charAt(i) <= '9')) {
                return false;
            }
        }
        return true;
    }
}
